#include "waylandwindow.h"



#include <QApplication>

#include <QDebug>

using namespace KWayland::Client;

WaylandWindow::WaylandWindow(PlasmaWindow *window, UKUIWindow *parent) :
    UKUIWindow(parent),
    m_plasmaWindow(window)
{
    if(m_plasmaWindow == nullptr) {
        qWarning()<<"wayland window init error: can not get wayland window data!";
    }
    init();
}

WaylandWindow::~WaylandWindow()
{

}

QString WaylandWindow::getAppName()
{
    return m_plasmaWindow->appId();
}

QString WaylandWindow::getTitle()
{
    return m_plasmaWindow->title();
}

QIcon WaylandWindow::getIcon()
{
    return m_plasmaWindow->icon();
}

const quint32 WaylandWindow::pid()
{
    return m_plasmaWindow->pid();
}

void WaylandWindow::requestClose()
{
    m_plasmaWindow->requestClose();
}

bool WaylandWindow::isClosable()
{
    return m_plasmaWindow->isCloseable();
}

void WaylandWindow::requestMax()
{
    m_plasmaWindow->requestToggleMaximized();
}

bool WaylandWindow::isMaximizable()
{
    return m_plasmaWindow->isMaximizeable();
}

bool WaylandWindow::isMaximized()
{
    return m_plasmaWindow->isMaximized();
}

void WaylandWindow::requestMin()
{
    m_plasmaWindow->requestToggleMinimized();
}

bool WaylandWindow::isMinimizable()
{
    return m_plasmaWindow->isMinimizeable();
}

bool WaylandWindow::isMinimized()
{
    return m_plasmaWindow->isMinimized();
}

void WaylandWindow::requestActivate()
{
    m_plasmaWindow->requestActivate();
}

void WaylandWindow::requestKeepAbove()
{
    m_plasmaWindow->requestToggleKeepAbove();
}

bool WaylandWindow::isKeepAboveable()
{
    return m_plasmaWindow->isKeepAbove();
}

void WaylandWindow::requestToggleKeepBelow()
{
    m_plasmaWindow->requestToggleKeepBelow();
}

bool WaylandWindow::isKeepBelowable()
{
    return m_plasmaWindow->isKeepBelow();
}

bool WaylandWindow::isMovable()
{
    return m_plasmaWindow->isMovable();
}

bool WaylandWindow::isResizable()
{
    return m_plasmaWindow->isResizable();
}

bool WaylandWindow::isFullScreenable()
{
    return m_plasmaWindow->isFullscreenable();
}

bool WaylandWindow::isFullScreen()
{
    return m_plasmaWindow->isFullscreen();
}

void WaylandWindow::init()
{

    connect(m_plasmaWindow,&PlasmaWindow::iconChanged, [this] {
        emit iconChanged();
    });

    connect(m_plasmaWindow,&PlasmaWindow::titleChanged, [this] {
        emit titleChanged();
    });
}



